//数组内所有数据类型一致
const arr1: number[] = [1, 2, 3]

//数组内所有数据类型不一致
const arr2: any[] = [4, 5, 'qf001']
const arr3: any = [4, 5, 'qf001', true]

//arr4是一个数组，数组内是字符串或者数字
const arr4: (number | string)[] = [4, 5, 'qf001']

//数组内部由多个对象组成
const arr5: { id: number; text: string }[] = [
    {id: 1, text: 'qf001'},
    {id: 2, text: 'qf002'},
    {id: 3, text: 'qf003'},
    {id: 4, text: 'qf004'}
]
//利用接口
interface IArr6 { id: number; text: string }
const arr6: IArr6[] = [
    {id: 1, text: 'qf001'},
    {id: 2, text: 'qf002'},
    {id: 3, text: 'qf003'},
    {id: 4, text: 'qf004'}
]

//利用 泛型 添加数组类型
interface IArr7 {
    id: number;
    text: string;
}
const arr7: Array<IArr7> = [
    {id: 1, text: 'qf001'},
    {id: 2, text: 'qf002'},
    {id: 3, text: 'qf003'},
    {id: 4, text: 'qf004'}
]
const arr8: Array<number> = [1, 2, 3]
const arr9: Array<string> = ["1", "3", "5"]